﻿using BaiTu.EventServices.Configuration;
using BaiTu.IEventServices;
using BaiTu.IOCServices;
using BaiTu.TestIng.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BaiTu.EventServices.Testing
{
    class Program
    {
        static void Main(string[] args)
        {
            IOCServices.EngineContext.Initialize(true);

            IEventBus eventBus = EngineContext.Current.Resolve<IEventBus>();
            IEventBusProvider busProvider = EngineContext.Current.Resolve<IEventBusProvider>();
      
            Console.WriteLine("Event_Pub OK, ready publish event.");

            BaiTu.TestIng.Domain.TestEvebt evt = new TestEvebt();


            int i = 0;
            while (true)
            {
                i++;
                evt.Name = DateTime.Now.ToString();
                eventBus.Publish<TestEvebt>(evt);
                Console.WriteLine(i);
            }

            Console.WriteLine("done.");
        }
    }
}
